import config from '../../config'

export function linkMouseEnter(e, obj) {
  // 修改线条颜色
  const shape = obj.findObject('EDGE_SHAPE')
  if (shape) {
    shape.stroke = go.Brush.lightenBy(config.edge.style.stroke, 0.2)
  }
  // 修改箭头颜色
  const arrow = obj.findObject('EDGE_ARROW')
  if (arrow) {
    shape.fill = '#A6E6A1'
    arrow.stroke = '#A6E6A1'
  }
  // 修改文本颜色
  const text = obj.findObject('EDGE_TEXT')
  if (text) {
    text.stroke = '#A6E6A1'
  }
}

export function linkMouseLeave(e, obj) {
  const shape = obj.findObject('EDGE_SHAPE')
  if (shape) {
    // Return the Shape's fill and stroke to the defaults
    // shape.fill = this.bluegrad
    shape.stroke = 'black'
  }

  const arrow = obj.findObject('EDGE_ARROW')
  if (arrow) {
    shape.fill = 'black'
    arrow.stroke = 'black'
  }

  // Return the TextBlock's stroke to its default
  const text = obj.findObject('EDGE_TEXT')
  if (text) {
    text.stroke = 'black'
  }
}
